package com.zd.web.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zd.entity.Chapter;
import com.zd.entity.Novel;
import com.zd.entity.NovelWriterType;
import com.zd.service.NovelService;
import com.zd.service.impl.NovelServiceImpl;

/**
 * Servlet implementation class LoadServlet
 */
@WebServlet("/LoadServlet")
public class LoadServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	NovelService novelService=new NovelServiceImpl();
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		System.out.println("进入loadservlet");
		//查14个作品类型+id
		List<String> typeList=novelService.novelType();
		request.setAttribute("typeList", typeList);
//		1.查 本周强推 类型+名字 16
		List<String[]> type_novelName_List=novelService.type_NovelName();
		request.setAttribute("type_novelName_List", type_novelName_List);
		List<String[]> type_novelName_List1=novelService.type_NovelName();
		request.setAttribute("type_novelName_List1", type_novelName_List1);
		//2.查 编辑推荐 查一本小说 img，名字，简介
		List<NovelWriterType> ttNovelListone=novelService.SelectEndNovelListone(); 
		request.setAttribute("ttNovelListone", ttNovelListone);
		//3.查 6本点击量高的；
		List<Novel> novelHitsList=novelService.novelHitsSelect();
		request.setAttribute("novelHitsList", novelHitsList);
		//4.v畅销榜，阅读15
		List<NovelWriterType> novelVipList=novelService.novelVipSelect();
		request.setAttribute("novelVipList", novelVipList);
		//5.畅销榜，阅读 15
		List<NovelWriterType> novelVipList2=novelService.novelVipSelect();
		request.setAttribute("novelVipList2", novelVipList2);
		List<NovelWriterType> novelVipList3=novelService.novelVipSelect();
		request.setAttribute("novelVipList3", novelVipList3);
		//6书友榜 收藏最多  15
		List<NovelWriterType> novelVipList4=novelService.novelVipSelect();
		request.setAttribute("novelVipList4", novelVipList4);
		//7阅读榜 阅读最多  15
		List<NovelWriterType> novelVipList5=novelService.novelVipSelect();
		request.setAttribute("novelVipList5", novelVipList5);
		//8新书榜 最新出炉的书 15
		List<NovelWriterType> newNovelList=novelService.SelectNewNovelList(); 
		request.setAttribute("newNovelList", newNovelList);
		List<NovelWriterType> newNovelListMore=novelService.SelectNewNovelListMore(); 
		request.setAttribute("newNovelListMore", newNovelListMore);
		//9 新书榜推荐 最新10本
		List<NovelWriterType> newNovelListMoreTen=novelService.SelectNewNovelListMoreTen(); 
		request.setAttribute("newNovelListMoreTen", newNovelListMoreTen);
		
		//完本精品
		List<NovelWriterType> endNovelListone=novelService.SelectEndNovelListone(); 
		request.setAttribute("endNovelListone", endNovelListone);
		//6个
		List<NovelWriterType> endNovelListmore=novelService.SelectEndNovelListmore(); 
		request.setAttribute("endNovelListmore", endNovelListmore);
		//完本排行
		List<NovelWriterType> endNovelListpp=novelService.SelectEndNovelListten(); 
		request.setAttribute("endNovelListpp", endNovelListpp);
		//查三本最近更新
		List<NovelWriterType> novelN=novelService.SelectnovelN(); 
		request.setAttribute("novelN", novelN);
		//查20条
		List<Chapter> noveChapter=novelService.selectNoveChapter();
		request.setAttribute("noveChapter", noveChapter);
		//VIP轮播展示
		List<Novel> lbList=novelService.selectVIP();
		request.setAttribute("lbList", lbList);
		HttpSession session=request.getSession();
		System.out.println();
		session.setAttribute("oP","oP");
		request.setAttribute("oP","oP");
		request.getRequestDispatcher("index.jsp").forward(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
	}

}
